/* 
    权限数据库模型
*/

import { SchemaFactory, Prop, Schema } from '@nestjs/mongoose'
import mongoose, { Document } from 'mongoose'

export type AuthorityDocument = Authority & Document

@Schema({ timestamps: true })
export class Authority {
  //用户id
  @Prop({ required: true, ref: 'User' })
  user: mongoose.Types.ObjectId
  //  贴吧id
  @Prop({ required: true, ref: 'Bar' })
  bar: mongoose.Types.ObjectId

  //身份
  @Prop({ required: true })
  identity: Array<string>
}

export const AuthoritySchema = SchemaFactory.createForClass(Authority)
